#include <dirent.h>

#define NULL 0

int main(int argc, char *argv[])
{
	DIR *dp;
	struct dirent *dirp;

	if (argc != 2){
		//err_quit("usage:ls directory_name");
		printf("usage:ls directory_name\n");
		exit(1);
	}

	if ((dp = opendir(argv[1])) == NULL){
		//err_sys("Can not open %s", argv[1]);
		printf("Can not open %s \n", argv[1]);
		exit(1);
	}

	while ((dirp = readdir(dp)) != NULL){
		printf("%s\n", dirp->d_name);
	}

	closedir(dp);
	exit(0);
}